home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1994-12-17 | 3.2 KB | 119 lines |
- MAIN
- Procedure MAIN
- 'This demo is mainly here to show the speed of the thing.
- 'As you can see the proc is actually faster when used to draw big
- ' circles or ellipses.
- '
- 'The white circles are drawn by SimpleArc, the grey ones by AMOS.
- '
- 'Use in the second part of the demo the left mouse button to
- ' paste an arc on the screen.
- '
- 'Modified by Andy Church to open its own screen and display actual
- ' times. Compile it to see it run faster!
- '
- Screen Open 0,320,200,4,0
- Palette $0,$777,$EEE,$AAA
- Flash Off : Curs Off
- 'first the small ones
- Ink 2
- Timer=0
- For I=1 To 20
- SIMPLEARC[100+4*I,100,10,10,0,360]
- Next I
- ST1#=Timer/((50.0-Ntsc*10)*20)
- Ink 3
- Timer=0
- For I=1 To 20
- Ellipse 200+4*I,100,10,10
- Next I
- ST2#=Timer/((50.0-Ntsc*10)*20)
- Wait 50
- 'now bigger circles
- Ink 2
- Timer=0
- For I=1 To 20
- SIMPLEARC[70+4*I,100,100,100,0,360]
- Next I
- LT1#=Timer/((50.0-Ntsc*10)*20)
- Ink 3
- Timer=0
- For I=1 To 20
- Ellipse 200+4*I,100,100,100
- Next I
- LT2#=Timer/((50.0-Ntsc*10)*20)
- Pen 0
- Print "Time in seconds needed"
- Print "to draw one circle "
- Print " "
- Print "\\\\\| Time (seconds) "
- Print "-----+--------------- "
- Print " | small "
- Print Using "S_Arc| ##.### ";ST1#
- Print Using "AMOS | ##.### ";ST2#
- Print "-----+--------------- "
- Print " | big "
- Print Using "S_Arc| ##.### ";LT1#
- Print Using "AMOS | ##.### ";LT2#
- Locate 1,23
- Print "Press left mouse button to continue."
- Curs Off : Cup : Cup
- Repeat
- Until Mouse Key=1
- Ink 0
- For I=1 To 200 Step 20
- SIMPLEARC[I,I,I,I,I*2,260]
- SIMPLEARC[321-I,I,I,I,I*2,260]
- SIMPLEARC[I,201-I,I,I,I*2,260]
- SIMPLEARC[321-I,201-I,I,I,I*2,260]
- Next I
- Fade 4 : Wait 60 : Cls 0
- Palette $0,$777,$EEE,$AAA
- Ink 1
- Print "Press right mouse button to quit."
- Repeat
- X=X Screen(X Mouse)
- Y=Y Screen(Y Mouse)
- Gr Writing 2
- SIMPLEARC[X,Y,80,80,ST,180]
- SIMPLEARC[X,Y,80,80,ST,180]
- SX=Sin(ST)*80
- SY=Cos(ST)*80
- Plot X+SX,Y+SY
- If Mouse Key=1
- Gr Writing 0
- SIMPLEARC[X,Y,80,80,ST,180]
- Add ST,10
- If ST>360 : ST=0 : End If
- End If
- Until Mouse Key=2
- End Proc
- Procedure SIMPLEARC[CX,CY,RX,RY,STDEG,TTOTDEG]
- '--- SimpleArc, by Branko Collin
- '--- v1.0 20-nov-1993
- '--- copy and use it as you like
- '
- 'This routine draws an arc, where arc is defined as part
- 'of an ellipse (alas, no fancy bezier stuff).
- '
- ' cx and cy : coordinates of the center
- ' rx and ry : radiuses in x and y directions
- ' stdeg : starting point in degrees
- ' ttotdeg : length of arc in degrees
- '
- Degree
- CUMDEG=STDEG+TTOTDEG
- ' sx and sy are the coords of the starting point
- SX=Sin(STDEG)*RX
- SY=Cos(STDEG)*RY
- ' so are ex and ey for the end point
- EX=Sin(STDEG+TTOTDEG)*RX
- EY=Cos(STDEG+TTOTDEG)*RY
- Plot CX+SX,CY+SY
- For I=STDEG/10 To CUMDEG/10
- X=Sin(I*10)*RX
- Y=Cos(I*10)*RY
- Draw To CX+X,CY+Y
- Next I
- Draw To CX+EX,CY+EY
- End Proc